/*
 * MainWindow.java
 *
 * Copyright (c) 2010 Jaymie Strecker (strecker at cs.umd.edu). All rights reserved.
 *
 * This file is part of Tonic.
 *
 * Tonic is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Tonic is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Tonic.  If not, see <http://www.gnu.org/licenses/>.
 */

package tonic.gui;

import javax.swing.*;
import java.awt.BorderLayout;
import java.awt.Dimension;

/**
 *
 * @author Jaymie Strecker (strecker at cs.umd.edu)
 */
public class MainWindow extends JFrame {

    public MainWindow() {
        super("Tonic");
        try {
            UIManager.setLookAndFeel(
                    UIManager.getCrossPlatformLookAndFeelClassName());
        } catch (Exception e) {
            // nop
        }

        ChordDisplay chordDisplay = new ChordDisplay();
        WaveDisplay waveDisplay = new WaveDisplay(this, chordDisplay);
        AudioControls audioControls = new AudioControls(waveDisplay, chordDisplay);

        getContentPane().setLayout(new BorderLayout());
        getContentPane().add(audioControls, BorderLayout.NORTH);
        getContentPane().add(waveDisplay, BorderLayout.CENTER);
        getContentPane().add(chordDisplay, BorderLayout.SOUTH);

        chordDisplay.setPreferredSize(new Dimension(
                (int) waveDisplay.getPreferredSize().getWidth(),
                (int) chordDisplay.getPreferredSize().getHeight()));

        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        pack();
        setVisible(true);
    }

    public static void main(String[] args) {
        new MainWindow(); 
    }

}
